package com.attilax.dataspider;

import com.attilax.exception.ExUtil;

public class BusPart {
	
	public	Runnable rx;
	public int freqRate=1;//freqTime  defaul is 1
	public int runCount=1;
	public int runtimeRate;
	public int getRuntimeRate() {
		return runtimeRate;
	}

	public void setRuntimeRate(int runtimeRate, int bus_freq) {
		this.runtimeRate = runtimeRate;
		if(this.mode.equals("time"))
		{
			int time=runtimeRate/bus_freq;
			freqRate=time;
		}
		
	}

	public String mode;
//	public void run() {
//		throw new RuntimeException("-- not imp");
//	}
	
//	public void incream() {
//		nowRunFreq++;
//	}
	
	public void run() {
//		if(mode.equals("time"))//freq
//		{
//			
//		}
		if (runCount >= freqRate) {
			this.rx.run();
			//re settimer
			runCount=1;
		}else
			runCount++;
	
		return;
		
	}

}
